  <template>
  <div class="app-container">
    <el-row>
      <!--区域数据-->
      <el-col :xs="24" v-show="treeVisibale === true" class="tree_bg">
        <!-- <div>
          <el-input
            v-model="keyWordName"
            placeholder="输入关键字进行过滤"
            clearable
            size="small"
            prefix-icon="el-icon-search"
            style="margin-bottom: 20px"
          />
        </div> -->
        <div class="head-container">
          <el-tree
            :data="areaOptions"
            :props="defaultProps"
            :expand-on-click-node="false"
            :filter-node-method="filterNode"
            ref="tree"
            node-key="id"
            default-expand-all
            highlight-current
            @node-click="handleNodeClick"
            v-loading="treeloading"
          >
            <span slot-scope="{ node, data }">
              <i v-if="data.treeType === 2" class="el-icon-school" style="color: #40a0ffd3;font-size: 12px;"></i>
              <span style="font-size: 13px;"> {{ node.label}}</span>
            </span>
          </el-tree>
        </div>
        <div class="tree_close" @click="changeTreeShow">
          <i class="el-icon-caret-left" style="color: white"></i>
        </div>
      </el-col>
      <el-col class="jiange"></el-col>
      <div class="tree_open" @click="changeTreeShow" v-show="treeVisibale === false">
        <i class="el-icon-caret-right" style="color: white"></i>
      </div>
      <el-col :xs="24" :class="treeVisibale ? 'table_small_bg' : 'table_big_bg'">
        <el-row class="line-bottom" v-show="showSearch">
          <el-col class="form_col">
            <el-form :model="queryParams" ref="queryForm" :size="size" v-show="showSearch" :label-width="labelWidth">
              <div id="searchFilter" :gutter="10" style="display: flex; flex-wrap: wrap">
                <el-form-item label="用户编号" prop="userId">
                  <el-input
                    v-model="queryParams.userId"
                    placeholder="请输入用户编号"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                <el-form-item label="设备编号" prop="TerminalID">
                  <el-input
                    v-model="queryParams.TerminalID"
                    placeholder="请输入设备编号"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                <el-form-item label="通讯地址" prop="communicateAddress">
                  <el-input v-model="queryParams.communicateAddress" placeholder="输入通讯地址" clearable size="small"></el-input>
                </el-form-item>
                <el-form-item label="抄表时间">
                  <el-date-picker
                    v-model="queryParams.FreezeTime"
                    style="width: 100%"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="请输入抄表时间"
                    v-if="showtime === 'day'"
                    @change="changeDay"
                  ></el-date-picker>
                  <el-date-picker
                    v-model="queryParams.FreezeTime"
                    style="width: 100%"
                    value-format="yyyy-MM"
                    type="month"
                    placeholder="请输入抄表时间"
                    v-if="showtime === 'month'"
                    @change="changeMonth"
                  ></el-date-picker>
                </el-form-item>
              </div>
            </el-form>
          </el-col>
          <el-col class="form_query">
            <el-button v-show="collapseAble" type="text" @click="shiftCollapseAble" class="text">
              <span>
                {{ fold ? '收起筛选' : '更多筛选' }}
              </span>
            </el-button>
            <el-button type="primary" @click="handleQuery" size="mini">查询</el-button>
            <el-button @click="resetQuery" size="mini">重置</el-button>
          </el-col>
        </el-row>

        <el-row :gutter="10" class="mb8 padding_top_bottom">
            <el-button type="primary" @click="handleday" size="mini" :plain="buttonDay">日</el-button>
            <el-button type="primary" @click="handlemonth" size="mini" :plain="buttonMonth">月</el-button>
          <!-- <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['datastatistics:terminalsfreezexb:add']"
            >新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['datastatistics:terminalsfreezexb:edit']"
            >修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['datastatistics:terminalsfreezexb:remove']"
            >删除</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['datastatistics:terminalsfreezexb:export']"
            >导出</el-button>
          </el-col> -->
          <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
          <RightDropdown :columns="columns" :showSearch.sync="showSearch" @queryTable="getList" @export="handleExport" :hasPermiExport="['datastatistics:terminalsfreezexb:export']"></RightDropdown>
        </el-row>

        <el-table v-loading="loading" :data="terminalsfreezexbList" @selection-change="handleSelectionChange" max-height="600" ref="table">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="用户名称" align="center" prop="userName" v-if="columns[0].visible" :show-overflow-tooltip="true"/>
          <el-table-column label="用户编号" align="center" prop="userId" v-if="columns[1].visible" :show-overflow-tooltip="true"/>
          <el-table-column label="门牌号" align="center" prop="roomName" v-if="columns[2].visible" :show-overflow-tooltip="true"/>
          <el-table-column label="设备编号" align="center" prop="TerminalID" v-if="columns[3].visible" :show-overflow-tooltip="true" width="160"/>
          <el-table-column label="通讯地址" align="center" prop="communicateAddress" v-if="columns[4].visible" :show-overflow-tooltip="true" width="130"/>
          <!-- <el-table-column label="平台表单自增主键" align="center" prop="ID"  width="180" v-if="false" :show-overflow-tooltip="true"/> -->
          <el-table-column label="冻结时间" align="center" prop="FreezeTime" v-if="columns[5].visible" :show-overflow-tooltip="true" width="130" />
          <!-- <el-table-column label="设备归属租户" align="center" prop="tenantId" v-if="true" :show-overflow-tooltip="true" width="120"/> -->
          <!-- <el-table-column label="厂家编号" align="center" prop="SupplierID" v-if="columns[0].visible" :show-overflow-tooltip="true"/> -->
          <!-- <el-table-column label="厂家名称" align="center" prop="SupplierID" v-if="columns[0].visible" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.terminal_supplier" :value="scope.row.SupplierID"/>
            </template>
          </el-table-column> -->
          <el-table-column label="净累积量(m³)" align="center" prop="cumulativeFlow" v-if="columns[6].visible" :show-overflow-tooltip="true" width="120"/>
          <el-table-column label="平均电池电压(V)" align="center" prop="terminalvolAvg" v-if="columns[7].visible" :show-overflow-tooltip="true" width="140"/>
          <el-table-column label="起始抄表读数(m³)" align="center" prop="StartReading" v-if="columns[8].visible" :show-overflow-tooltip="true" width="140"/>
          <el-table-column label="起始抄表时间" align="center" prop="StartReadingtime" v-if="columns[9].visible" :show-overflow-tooltip="true" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.StartReadingtime, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="终止抄表读数(m³)" align="center" prop="EndReading" width="140" v-if="columns[10].visible" :show-overflow-tooltip="true"/>
          <el-table-column label="终止抄表时间" align="center" prop="EndReadingtime" v-if="columns[11].visible" :show-overflow-tooltip="true" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.EndReadingtime, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="用户平均用水量(m³)" align="center" prop="userAvg" v-if="columns[12].visible" :show-overflow-tooltip="true" width="160"/>
          <el-table-column label="环比上一周期" align="center" prop="hb" v-if="columns[13].visible" :show-overflow-tooltip="true" width="140" />
          <el-table-column label="用水状态" align="center" prop="ParamType" v-if="columns[14].visible" :show-overflow-tooltip="true"/>
          <el-table-column label="冻结类型" align="center" prop="frozenType" v-if="columns[15].visible" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.frozenType === 'day'">日冻结</el-tag>
              <el-tag v-if="scope.row.frozenType === 'month'">月冻结</el-tag>
            </template>
          </el-table-column>
          <!-- <el-table-column label="创建时间" align="center" prop="CreateDate" width="180" v-if="columns[15].visible" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.CreateDate, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column> -->
          <!-- <el-table-column label="备注" align="center" prop="Remark" v-if="columns[16].visible" :show-overflow-tooltip="true"/> -->
          <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['datastatistics:terminalsfreezexb:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['datastatistics:terminalsfreezexb:remove']"
              >删除</el-button>
            </template>
          </el-table-column> -->
        </el-table>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>

    <!-- 添加或修改小冻结数据（设备维度）对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!-- <el-form-item label="设备归属租户" prop="tenantId">
          <el-input v-model="form.tenantId" placeholder="请输入设备归属租户" />
        </el-form-item> -->
        <el-form-item label="归属水司" prop="tenantId">
          <el-select v-model="form.tenantId" placeholder="请选择归属水司" style="width: 202px;">
            <el-option
              v-for="dict in dict.type.belong_department"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value.toString()"
            ></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="厂家名称" prop="SupplierID">
          <el-input v-model="form.SupplierID" placeholder="请输入厂家编号" />
        </el-form-item> -->
        <el-form-item label="设备编号" prop="TerminalID">
          <el-input v-model="form.TerminalID" placeholder="请输入设备编号" />
        </el-form-item>
        <el-form-item label="净累积量" prop="cumulativeFlow">
          <el-input v-model="form.cumulativeFlow" placeholder="请输入净累积量" />
        </el-form-item>
        <el-form-item label="平均电池电压" prop="terminalvolAvg">
          <el-input v-model="form.terminalvolAvg" placeholder="请输入平均电池电压" />
        </el-form-item>
        <el-form-item label="起始抄表读数" prop="StartReading">
          <el-input v-model="form.StartReading" placeholder="请输入起始抄表读数" />
        </el-form-item>
        <el-form-item label="起始抄表时间" prop="StartReadingtime">
          <el-date-picker clearable
            v-model="form.StartReadingtime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择起始抄表时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="终止抄表读数" prop="EndReading">
          <el-input v-model="form.EndReading" placeholder="请输入终止抄表读数" />
        </el-form-item>
        <el-form-item label="终止抄表时间" prop="EndReadingtime">
          <el-date-picker clearable
            v-model="form.EndReadingtime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择终止抄表时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="用户平均用水量" prop="userAvg">
          <el-input v-model="form.userAvg" placeholder="请输入用户平均用水量" />
        </el-form-item>
        <el-form-item label="环比上一周期" prop="hb">
          <el-input v-model="form.hb" placeholder="请输入环比上一周期" />
        </el-form-item>
        <el-form-item label="冻结时间" prop="FreezeTime">
          <el-input v-model="form.FreezeTime" placeholder="请输入冻结时间" />
        </el-form-item>
        <!-- <el-form-item label="创建时间" prop="CreateDate">
          <el-date-picker clearable
            v-model="form.CreateDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item> -->
        <el-form-item label="备注" prop="Remark">
          <el-input v-model="form.Remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listTerminalsfreezexb, getTerminalsfreezexb, delTerminalsfreezexb, addTerminalsfreezexb, updateTerminalsfreezexb } from "@/api/dataquery/metered/terminalsfreezexb";
// import { getAreasList } from '@/api/basedata/areas'
import moment from 'moment';

export default {
  name: "TerminalsFreezexb",
  dicts: ['belong_department','terminal_supplier'],
  data() {
    return {
      // 按钮状态
      buttonDay: false,
      buttonMonth: true,
      size:'small',
      collapseAble: false,
      fold: false,
      maxShow: '4',
      labelWidth: '100px',
      showtime: 'day',
      dayStorage: moment(new Date().getTime() - 3600 * 1000 * 24).format('YYYY-MM-DD'),
      monthStorage: moment(new Date(new Date().getFullYear(), new Date().getMonth() - 1, new Date().getDate())).format('YYYY-MM'),
      // 列信息
      columns: [
        { key: 0, label: `用户名称`, visible: true },
        { key: 1, label: `用户编号`, visible: true },
        { key: 2, label: `门牌号`, visible: true },
        { key: 3, label: `设备编号`, visible: true },
        { key: 4, label: `通讯地址`, visible: true },
        { key: 5, label: `冻结时间`, visible: true },
        { key: 6, label: `净累积量`, visible: true },
        { key: 7, label: `平均电池电压`, visible: true },
        { key: 8, label: `起始抄表读数`, visible: true },
        { key: 9, label: `起始抄表时间`, visible: true },
        { key: 10, label: `终止抄表读数`, visible: true },
        { key: 11, label: `终止抄表时间`, visible: true },
        { key: 12, label: `用户平均用水量`, visible: true },
        { key: 13, label: `环比上一周期`, visible: true },
        { key: 14, label: `用水状态`, visible: true },
        { key: 15, label: `冻结类型`, visible: true },
      ],
      defaultProps: {
        children: "children",
        label: "label",
      },
      // 区域树选项
      areaOptions: [],
      // 区域名称
      keyWordName: undefined,
      // 树状态
      treeVisibale: true,
      // 遮罩层
      loading: true,
      treeloading: true,
      // 选中数组
      ids: [],
      TerminalIDs:[],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 小冻结数据（设备维度）表格数据
      terminalsfreezexbList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        tenantId: null,
        SupplierID: null,
        TerminalID: null,
        StartReadingtime: null,
        EndReadingtime: null,
        treeAreaCode: null,
        treeLdId: null,
        frozenType: 'day',
        FreezeTime: moment(new Date().getTime() - 3600 * 1000 * 24).format('YYYY-MM-DD'),
        userId: null,
        communicateAddress: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        tenantId: [
          { required: true, message: "归属水司不能为空", trigger: "change" }
        ],
        SupplierID: [
          { required: true, message: "厂家名称不能为空", trigger: "blur" }
        ],
        TerminalID: [
          { required: true, message: "设备编号不能为空", trigger: "blur" }
        ],
        cumulativeFlow: [
          { required: true, message: "净累积量不能为空", trigger: "blur" }
        ],
        frozenType: [
          { required: true, message: "冻结类型", trigger: "change" }
        ],
        FreezeTime: [
          { required: true, message: "冻结时间不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getAreaTree();
  },
  mounted() {
    // this.handleday()
    this.getList()
    // this.tip()
    // 通过最大显示个数控制展开/折叠
    if (this.maxShow > 0) {
      this.minShowControl()
    }
  },
  watch: {
    // 根据名称筛选区域树
    keyWordName(val) {
      this.$refs.tree.filter(val);
    }
  },
  methods: {
    changeDay(e){
      this.dayStorage = e
    },
    changeMonth(e){
      this.monthStorage = e
    },
    // 页面提示信息
    // tip() {
    //   this.$modal.msgWarning("请选择一个楼栋查看数据!")
    //   this.loading = false;
    // },
    // 初始化表格 解决表格固定操作列的问题
    init(){
      // 调用接口获取到数据后
      let _self = this
      this.$nextTick(() => {
        window.setTimeout(() => {
          _self.$refs.table.doLayout()
        }, 100)
      })
    },
    // 展开折叠按钮
    shiftCollapseAble() {
      this.fold = !this.fold
      this.minShowControl()
    },
    // 通过maxShow控制元素显示/折叠
    minShowControl() {
      const group = window.document.querySelectorAll(`#searchFilter .el-form-item.el-form-item--${this.size}`)
      const len = group?.length ? group?.length - 1 : 0
      if (this.maxShow < len) {
        group.forEach((item, index) => {
          if (index > this.maxShow - 1 && index < len) {
            item.hidden = !this.fold
          }
        })
        this.collapseAble = true
      } else {
        this.collapseAble = false
      }
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    // 节点单击事件
    handleNodeClick(data) {
      this.queryParams.treeAreaCode = null
      this.queryParams.treeLdId = null
      if(data.treeType === 1){
        this.queryParams.treeAreaCode = data.areaCode;
      }else if(data.treeType === 2){
        this.queryParams.treeLdId = data.ldId;
      }
      this.handleQuery();
    },
    handleNodeExpend(data){
      if(data.treeType === 2){
        getldroom(data.ldId).then(response => {
          if(response.rows.length > 0){
            response.rows.forEach((item) => {
              let obj = {
                id: item.roomId,
                label: item.roomName,
                children: [],
                treeType: item.treeType
              }
              data.children.push(obj);
            })
          }
        })
      }
    },
    /** 查询区域下拉树结构 */
    getAreaTree() {
      this.treeloading = true
      let list_ = JSON.parse(localStorage.getItem('list'))
      list_.forEach((item) => {
        if(item.children === null){
          item.children = []
        }
        if(item.louDongs !=null && item.louDongs !=[]){
          item.children = item.children.concat(item.louDongs)
        }
        let childrens = item.children
        var obj = {
          id: item.treeType === 1?  item.areaCode : item.id,
          label: item.treeType === 1? item.areaName : item.ldName,
          children: item.children && item.children.length > 0 ? this.copyTree(childrens) : item.childrens,
        }
        this.areaOptions.push(obj)
        this.treeloading = false
      })
    },
    copyTree(list) {
      list.forEach((item) => {
        let flag1 = false
        let childrens = []

        if((null != item.children  && item.children.length > 0)||(null != item.louDongs  && item.louDongs.length > 0)){
          flag1 = true
          if(item && item.children && item.louDongs){
            childrens = item.children.concat(item.louDongs)
          }else if(item && item.children && item.louDongs == null){
            childrens = item.children
          }else if(item && item.louDongs && item.children == null ){
            childrens = item.louDongs
          }
        }else{
          flag1 = false
        }
        item.id = item.treeType === 1?  item.areaCode : item.id;
        item.label = item.treeType === 1? item.areaName : item.ldName;
        item.children = childrens;
        if (flag1) {
          this.copyTree(item.children);
        }
      });
      return list;
    },
    // 区域树懒加载
    loadNode(node, resolve) {
       setTimeout(() => {
        if(node.data.children === null){
          resolve([])
        }else{
          resolve(node.data.children)
        }
      }, 600);
    },
    // 改变tree的显示与隐藏
    changeTreeShow(){
      this.treeVisibale =!this.treeVisibale
    },
    /** 查询小冻结数据（设备维度）列表 */
    getList() {
      this.loading = true;
      listTerminalsfreezexb(this.queryParams).then(response => {
        this.terminalsfreezexbList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        ID: null,
        tenantId: null,
        SupplierID: null,
        TerminalID: null,
        cumulativeFlow: null,
        terminalvolAvg: null,
        StartReading: null,
        StartReadingtime: null,
        EndReading: null,
        EndReadingtime: null,
        userAvg: null,
        hb: null,
        ParamType: null,
        frozenType: null,
        FreezeTime: null,
        CreateDate: null,
        Remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.frozenType = 'day',
      this.queryParams.FreezeTime =  moment(new Date().getTime() - 3600 * 1000 * 24).format('YYYY-MM-DD')
      this.$refs.tree.setCurrentKey(null);
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.ID)
      this.TerminalIDs = selection.map(item => item.TerminalID)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加户表冻结数据";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const ID = row.ID || this.ids
      getTerminalsfreezexb(ID).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改户表冻结数据";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.ID != null) {
            updateTerminalsfreezexb(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTerminalsfreezexb(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    handleday(e){
      let target = e.target
      target.blur()
      this.buttonDay = false
      this.buttonMonth = true
      let start = new Date();
      this.queryParams.frozenType = 'day'
      this.showtime = 'day'
      // this.queryParams.FreezeTime =  moment(start.getTime() - 3600 * 1000 * 24).format('YYYY-MM-DD')
      this.queryParams.FreezeTime = this.dayStorage
      listTerminalsfreezexb(this.queryParams).then(response => {
        this.terminalsfreezexbList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    handlemonth(e){
      let target = e.target
      target.blur()
      this.buttonDay = true
      this.buttonMonth = false
      let start = new Date();
      this.queryParams.frozenType = 'month'
      this.showtime = 'month'
      this.queryParams.FreezeTime = this.monthStorage
      // this.queryParams.FreezeTime =  moment(new Date(new Date().getFullYear(), new Date().getMonth() - 1, new Date().getDate())).format('YYYY-MM')
      listTerminalsfreezexb(this.queryParams).then(response => {
        this.terminalsfreezexbList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const IDs = row.ID || this.ids;
      const TerminalIDs = row.TerminalID || this.TerminalIDs;
      this.$modal.confirm('是否确认删除设备编号为"' + TerminalIDs + '"的冻结数据？').then(function() {
        return delTerminalsfreezexb(IDs);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('datastatistics/terminalsfreezexb/export', {
        ...this.queryParams
      }, `户表冻结数据_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style lang="scss" scoped>
  .form_col{
    width: 80%;
    ::v-deep .el-form {
      width: 100%;
    }
    ::v-deep .el-form-item {
      width: 25%;
    }
  }
  .form_query{
    width: 20%;
    text-align: right;
  }
</style>
